package com.oneday.ashop.console.common.tags;

import com.oneday.ashop.console.base.shiro.filter.BaseResourceFilter;
import com.oneday.ashop.core.entity.Resource;
import com.oneday.ashop.core.tags.HTMLTagSupport;

/**
 * 菜单标签
 * User:bob.yang
 * Date 2016/7/13 0013
 */
public class MenuTag extends HTMLTagSupport {

    /**
     * 页面请求的相对路径
     */
    private String url;

    @Override
    protected String generateHTML() {
        Resource resource = BaseResourceFilter.resourceMap.get(url);
        if(resource == null) {
            return null;
        }else {
            return "<a href='" + resource.getUrl() + "'>" + resource.getName() + "</a>";
        }
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
